<?php
class Nhtzs_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    //获取当天商品信息
    function getGoodsArray(){
        $date = date("Y-m-d");//日期：当天
        $this->db->where("publishDate",$date);
        $this->db->where('status',1);
        $this->db->where('isDel !=',1);
        $this->db->order_by("sort");
       
        $query = $this->db->get("zz_extend_neihantu_goods");
        $goodsArray = $query->result_array();
        //如果没有数据 ，取前一天的数据
        if (!$goodsArray) {
            $date = date("Y-m-d",strtotime("-1 day"));//日期：前一天
        	$this->db->where("publishDate",$date);
       		$query = $this->db->get("zz_extend_neihantu_goods");
        	$goodsArray = $query->result_array();
        }
        return array($goodsArray,$date);
    }
	//商品的点击
    function AjaxGoodsClick($id){
    	$this->db->set("clickNum","IFNULL(clickNum+1,1)",false);
    	$this->db->where("id",$id);
    	$this->db->update("priceninepointnine");
    	return $this->db->affected_rows();
    }
}